package com.michael.study.jetpack.module.dsl.user

class UserWrapper {

    private val addres = Address()

    var name : String? = null
    var password : String? = null

    fun  address(block : Address.() -> Unit) : Address {
        addres.block()
        return addres
    }

    internal fun getAddress() = addres
}

fun user(block : UserWrapper.() -> Unit) : User {

    val userWrapper = UserWrapper()
    userWrapper.block()

    val user = User()
    user.name = userWrapper.name
    user.password = userWrapper.password
    user.address = userWrapper.getAddress()

    return user
}